local bijing = fk.CreateSkill{
    name = "XD__bijing",
}
Fk:loadTranslationTable{
    ["XD__bijing"] = "闭境",
    [":XD__bijing"] = "其他角色的回合开始时，你可以明置一张可造成伤害的牌，令其此回合不能使用与之相同类型的可造成伤害的牌。",
    ["#XD__bijing"] = "闭境：你可以明置一张伤害牌，令 %dest 本回合不能使用同类型的伤害牌",
    ["@[cardtypes]XD__bijing-turn"] = "闭境"
}
local DIY = require "packages/diy_utility/_base"

bijing:addEffect(fk.TurnStart, {
    can_trigger = function (self, event, target, player, data)
        return player:hasSkill(bijing.name) and target ~= player and not player:isKongcheng()
    end,
    on_cost = function (self, event, target, player, data)
        local ids = table.filter(player:getCardIds("h"), function (id)
            return not table.contains(DIY.getShownCards(player), id) and Fk:getCardById(id, true).is_damage_card
        end)
        if #ids > 0 then
            local cards = player.room:askToCards(player, {
                max_num = 1,
                min_num = 1,
                prompt = "#XD__bijing::"..target.id,
                skill_name = bijing.name,
                include_equip = false,
                pattern = tostring(Exppattern{ id = ids }),
            })
            if #cards > 0 then
                event:setCostData(self, {cards = cards})
                return true
            end
        end
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        local cards = event:getCostData(self).cards
        DIY.showCards(player, cards)
        room:addTableMarkIfNeed(target, "@[cardtypes]XD__bijing-turn", Fk:getCardById(cards[1]).type)
    end,
})
bijing:addEffect("prohibit",{
    prohibit_use = function (self, player, card)
        if #player:getTableMark("@[cardtypes]XD__bijing-turn") > 0 and card.is_damage_card then
            return table.contains(player:getTableMark("@[cardtypes]XD__bijing-turn"), card.type)
        end
    end,
})

return bijing